#include<stdio.h>

int main()
{
	int n,m,flag,sign,key,t;
	int a[25],b[25],c[25];
	scanf("%d %d",&n,&m);
	c[0]=1;
	for(key=0;key<n;key++)
	{
		scanf("%d",&a[key]);
		c[key+1]=c[key]*a[key];
	}
	for(sign=0;sign<n;sign++)
	{
		t=m%c[sign+1]-m%c[sign];
		b[sign]=t/c[sign];
		printf("%d",b[sign]);
		if(sign!=n-1) printf(" ");
	}
	return 0;
}
